<template>
  <div>
    <eagle-page-list
      ref="eaglePageList"
      @bindData="bindData"
      :queryParams="queryParams"
      :controller="controller"
      placeholder="请输入事故名称搜索"
      :filterParams="filterParams"
      :conditions="conditions"
      filterTab
      :pageSize="20"
    >
      <div slot="list">
        <eagle-cell
          style="margin-top: 10px"
          class="br-8"
          v-for="(item, index) in list"
          :key="index"
        >
          <div>
            <div>
              <eagle-row
                gutter="15"
                style="word-break:break-all"
              >
                <eagle-col>
                  <b style="font-size: 13px">{{ item.Contents }}</b>
                </eagle-col>
              </eagle-row>
              <eagle-row
                gutter="15"
                style="word-break:break-all"
              >
                <eagle-col>
                  <img
                    class="icon"
                    src="@/assets/Images/AppIcon/icon_list_type.png"
                  />事故名称：{{ item.AccidentName }}
                </eagle-col>
              </eagle-row>
              <!-- <eagle-row gutter="15">
                                    <eagle-col>
                                        <img class="icon" src="@/assets/Images/AppIcon/icon_list_area.png" />整改行动:{{ item.Contents }}
                                    </eagle-col>
                                </eagle-row> -->
              <eagle-row gutter="20">
                <eagle-col>
                  <img
                    class="icon"
                    src="@/assets/Images/AppIcon/icon_list_user.png"
                  />责任人：{{ item.RectificationPeople }}
                </eagle-col>
              </eagle-row>
              <eagle-row gutter="20">
                <eagle-col>
                  <img
                    class="icon"
                    src="@/assets/Images/AppIcon/icon_list_date.png"
                  />完成日期：{{ item.FinishDate | formatDate }}
                </eagle-col>
              </eagle-row>
              <eagle-row gutter="20">
                <eagle-col>
                  <img
                    class="icon"
                    src="@/assets/Images/AppIcon/icon_list_date.png"
                  />整改完成日期：{{ getStatusTime(item.EditDate ) }}
                </eagle-col>
              </eagle-row>
              <eagle-row gutter="20">
                <eagle-col>
                  <img
                    class="icon"
                    src="@/assets/Images/AppIcon/icon_list_date.png"
                  />验收日期：{{ item.ReceptionDate | formatDateTime }}
                </eagle-col>
              </eagle-row>
              <eagle-row gutter="15">
                <eagle-col>
                  <img
                    class="icon"
                    src="@/assets/Images/AppIcon/icon_list_type.png"
                  />状态：{{ getStatus(item.Status) }}
                </eagle-col>
              </eagle-row>
              <van-divider />
            </div>

          </div>
          <div class="op_btn">
            <div
              class="btn_item"
              @click="view(item)"
            >
              <img
                src="@/assets/Images/AppIcon/icon_list_edit.png"
                alt=""
              />
              <div class="mr-10">详情</div>
            </div>
          </div>
        </eagle-cell>
      </div>
    </eagle-page-list>
  </div>
</template>
<script>
import { getMenuByMenuCode } from "@/api/common";
export default {
  data() {
    return {
      list: [],
      searchValue: "",
      conditions: {},
      controller: "/WHInvestigationReportLog",
      queryParams: {
        dataType: "List",
        keywords: "",
        page: 0,
      },
      title: "不限",
      filterParams: [
        {
          name: "Status",
          title: "状态",
          originTitle: "状态",
          dataType: "int",
          data: [
            { text: "不限", value: "" },
            { text: "待整改", value: "10" },
            { text: "未验收", value: "50" },
            { text: "已验收", value: "100" },
          ],
        },
      ],
      rightValue: 0,
      userChooseDialogShow1: false,
    };
  },
  created() {
    this.getMenuByMenuCode();
  },
  mounted() {},
  methods: {
    bindData(data) {
      this.list = [];
      if (data) {
        this.list = data;
      }
    },
    // handleChange(value) {
    //   
    //   this.title = value;
    // },
    getMenuByMenuCode() {
      var me = this;
      getMenuByMenuCode("WH_AccidentInitialReport_List").then((res) => {
        me.rightValue = res.data ? res.data.RoleRightValue : 0;
      });
    },
    getStatus(val) {
      if (val == 50) {
        return "未验收";
      } else if (val == 100) {
        return "已验收";
      } else if (val == 10) {
        return "待整改";
      }
    },
    getStatusTime(val) {
      let date = new Date(val);
      let year = date.getFullYear();
      let month = date.getMonth() + 1;
      let day = date.getDate();
      let hour = date.getHours();
      let minute = date.getMinutes();
      let ss =
        date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
      return `${year}-${month}-${day} ${hour}:${minute}:${ss}`;
    },
    view(item) {
      this.$router.push({
        path: "/whInvestigationReportLogRMBrowseDetail",
        query: { id: item.ID },
      });
    },
  },
};
</script>
<style lang="less" scoped>
.phone {
  position: relative;
  .code {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 12px;
  }
}
.register-info {
  background-color: #e8f1f8;
  padding-bottom: 20px;
}
.img-box {
  height: 50px;
  width: 50px;
  padding: 10px;
  position: absolute;
  left: 50%;
  top: 60px;
  background-color: #fff;
  border-radius: 50%;
  overflow: hidden;
}
.popup-title {
  line-height: 35px;
  padding: 10px;
  font-size: 15px;
  padding-left: 20px;
}

.op_btn {
  display: flex;
  justify-content: flex-end;
  .btn_item {
    display: flex;
    align-items: center;
    img {
      height: 15px;
      width: 15px;
      margin-right: 5px;
    }
  }
}

.search-box {
  height: 1rem;
}
</style>